package cn.hellochaos.generator.mapper;

import cn.hellochaos.generator.entity.CaipuList;
import cn.hellochaos.generator.entity.UserCookbook;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
* <p>
*  Mapper 接口
* </p>
*
* @author test
* @since 2021-01-23
*/
@Mapper
@Repository
public interface UserCookbookMapper extends BaseMapper<UserCookbook> {


    @Select("SELECT\n" +
            "\t* \n" +
            "FROM\n" +
            "\tcaipu_list \n" +
            "WHERE\n" +
            "\tid_cookbook IN ( SELECT cookbook_id FROM user_cookbook WHERE user_id = #{id} )")
    List<CaipuList> getUserAllFavorite(Integer id);
}
